package com.harmonk.firstscene.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.harmonk.firstscene.db.entity.Road
import kotlinx.coroutines.flow.Flow

@Dao
interface RoadDao {
    @Query("SELECT * FROM roads WHERE roadId = :id")
    suspend fun getRoadById(id: Long): Road
    @Query("SELECT * FROM roads ORDER BY roadId ASC")
    fun getAllRoads(): Flow<List<Road>>
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insertRoad(road: Road): Long
    @Update
    suspend fun updateRoad(road: Road)
    @Delete
    suspend fun deleteRoad(road: Road)
}